#											   -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([base], [1.0])
dnl AC_CONFIG_SRCDIR([Makefile.am])
#AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([foreign color-tests dist-bzip2 parallel-tests])
#AM_INIT_AUTOMAKE([foreign gnu])
#AC_CONFIG_MACRO_DIR([m4])

#CXXFLAGS="$CXXFLAGS -Wno-deprecated -g  -Wall -m32 -march=i686"
CXXFLAGS="$CXXFLAGS -Wno-deprecated -Wall"

#m4_include([m4/ax_boost_thread.m4])
#m4_include([m4/ax_check_mysqlr.m4])
#m4_include([m4/ax_check_libeasy.m4])
#m4_include([m4/ax_check_curl.m4])
#m4_include([m4/ax_shms_service.m4])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
#AC_PROG_RANLIB

AM_PATH_PYTHON

#BOOST_LDFLAGS="-L/usr/lib/"

AC_ARG_ENABLE(check,
			  [  --disable-check		  Disable dependence check],
			  NOCHECK_DEP="yes", NOCHECK_DEP="no")

if test $NOCHECK_DEP = no ; then
	AX_BOOST_THREAD
	AX_CHECK_MYSQLR
	AX_CHECK_LIBEASY
	AX_CHECK_CURL
fi

AC_ARG_ENABLE(cr,
			  [  --enable-cr		  Enable codecoverage information],
			  USE_CR="$enableval", USE_CR="no")
			  
AC_ARG_ENABLE(debug,
			  [  --enable-debug		  Enable debugging information],
			  USE_DEBUG="$enableval", USE_DEBUG="no")

#AC_ARG_ENABLE(redis,
#			  [  --enable-redis		 Enable redis devel],
#			  USE_REDIS="$enableval", USE_REDIS="no")


if test $USE_CR = yes ; then
   CXXFLAGS="$CXXFLAGS  -fprofile-arcs -ftest-coverage "
fi

if test $USE_DEBUG = yes ; then 
   CXXFLAGS="$CXXFLAGS -g "
else 
   CXXFLAGS="$CXXFLAGS -g"
fi

AM_CONDITIONAL([HAS_REDIS], [test x$USE_REDIS != xno])

if test x$USE_REDIS != xno ; then
	AC_DEFINE(HAS_REDIS)
fi

AC_DEFINE(BUILD_DATE, ["m4_esyscmd([date +'%Y%m%d %H:%M' |tr -d '\n'])"], [Build date])
AC_DEFINE(BUILD_HOST, ["m4_esyscmd([hostname |tr -d '\n'])"], [Build host])

#AC_SUBST(AACE_GEN, ["m4_esyscmd([pwd |tr -d '\n'])/tools/Autogen/Autogen"])

AC_CONFIG_FILES([Makefile
				 libbase/Makefile
				 ])
AC_OUTPUT
